/**
 * 
 */
package org.alipay4j.model.sns;

import java.io.Serializable;

import org.alipay4j.AlipayException;
import org.alipay4j.http.Response;

import com.alibaba.fastjson.JSONObject;

/**
 * 网页授权用户信息
 * @author 贺亮
 */
public class SnsUser implements Serializable{
	/** */
	private static final long serialVersionUID = -6968311287047200215L;
	/** 支付宝用户的userId */
	private String user_id;
	/** 用户头像地址 */
	private String avatar;
	/** 省份名称 */
	private String province;
	/** 市名称 */
	private String city;
	/** 用户昵称 */
	private String nick_name;
	/** 是否是学生 */
	private String is_student_certified;
	/** 用户类型（1/2）  1代表公司账户2代表个人账户 */
	private String user_type;
	/** 	用户状态（Q/T/B/W）。 
			Q代表快速注册用户 
			T代表已认证用户 
			B代表被冻结账户 
			W代表已注册，未激活的账户*/
	private String user_status;
	/** 是否通过实名认证。T是通过 F是没有实名认证。 */
	private String is_certified;
	/** 性别（F：女性；M：男性）【注意】只有is_certified为T的时候才有意义，否则不保证准确性.  */
	private String gender;
	
	public SnsUser() {
		super();
	}
	
	/**
	 * 通过支付宝返回的Response创建对象
	 * @param response 返回的数据流
	 * @throws AlipayException
	 */
	public SnsUser(Response response) throws AlipayException {
		this(response.asJSONObject().getJSONObject("alipay_user_info_share_response"));
	}
	
	
	/**
	 * 通过支付宝返回的Json对象创建用户对象
	 * @param jsonObj JSON数据包
	 * @throws AlipayException
	 */
	public SnsUser(JSONObject jsonObj) throws AlipayException {
		super();
		this.user_id = jsonObj.getString("user_id");
		this.avatar = jsonObj.getString("avatar");
		this.province = jsonObj.getString("province");
		this.city = jsonObj.getString("city");
		this.nick_name = jsonObj.getString("nick_name");
		this.is_student_certified = jsonObj.getString("is_student_certified");
		this.user_type = jsonObj.getString("user_type");
		this.user_status = jsonObj.getString("user_status");
		this.is_certified = jsonObj.getString("is_certified");
		this.gender = jsonObj.getString("gender");
	}
	
	public SnsUser(String user_id, String avatar, String province, String city,
			String nick_name, String is_student_certified, String user_type,
			String user_status, String is_certified, String gender) {
		super();
		this.user_id = user_id;
		this.avatar = avatar;
		this.province = province;
		this.city = city;
		this.nick_name = nick_name;
		this.is_student_certified = is_student_certified;
		this.user_type = user_type;
		this.user_status = user_status;
		this.is_certified = is_certified;
		this.gender = gender;
	}
	public String getUser_id() {
		return user_id;
	}
	public void setUser_id(String user_id) {
		this.user_id = user_id;
	}
	public String getAvatar() {
		return avatar;
	}
	public void setAvatar(String avatar) {
		this.avatar = avatar;
	}
	public String getProvince() {
		return province;
	}
	public void setProvince(String province) {
		this.province = province;
	}
	public String getCity() {
		return city;
	}
	public void setCity(String city) {
		this.city = city;
	}
	public String getNick_name() {
		return nick_name;
	}
	public void setNick_name(String nick_name) {
		this.nick_name = nick_name;
	}
	public String getIs_student_certified() {
		return is_student_certified;
	}
	public void setIs_student_certified(String is_student_certified) {
		this.is_student_certified = is_student_certified;
	}
	public String getUser_type() {
		return user_type;
	}
	public void setUser_type(String user_type) {
		this.user_type = user_type;
	}
	public String getUser_status() {
		return user_status;
	}
	public void setUser_status(String user_status) {
		this.user_status = user_status;
	}
	public String getIs_certified() {
		return is_certified;
	}
	public void setIs_certified(String is_certified) {
		this.is_certified = is_certified;
	}
	public String getGender() {
		return gender;
	}
	public void setGender(String gender) {
		this.gender = gender;
	}
	public static long getSerialversionuid() {
		return serialVersionUID;
	}
	
}
